<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<title>角色管理</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<script th:src="@{/js/includ.js}"></script>
</head>
<body>
	<div class="layui-form" lay-filter="layuiadmin-form-role"
		id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">

		<input name="roleId" autocomplete="off" class="layui-input"
			type="hidden" th:if="${role!=null}" th:value="${role.roleId}" />
		<div class="layui-form-item">
			<label class="layui-form-label"><span class="layui-badge-dot"></span>&nbsp;角色名称</label>
			<div class="layui-input-inline">
				<input type="text" name="roleName" lay-verify="required"
					th:value="${role?.roleName}" placeholder="角色名称" autocomplete="off"
					class="layui-input">
			</div>
		</div>
		<div class="layui-form-item" th:switch="${role!=null}">
			<label class="layui-form-label"><span class="layui-badge-dot"></span>&nbsp;权限范围</label>
			<div class="layui-input-block" th:case="true">
				<fieldset th:each="menu:${menus}">
					<legend>
						<input type="checkbox" name="menuList" th:value="${menu.menuId }"
							lay-skin="primary" lay-filter="checkedListener"
							th:title="${menu.title }"
							th:checked="${#lists.contains(role.menuIdList, menu.menuId)}">
					</legend>
					<div class="layui-input-block"
						th:each="childrenMenu:${menu?.children}">
						<input type="checkbox" name="menuList"
							lay-filter="checkedListener" th:value="${childrenMenu.menuId }"
							lay-skin="primary" th:title="${childrenMenu.title }"
							th:checked="${#lists.contains(role.menuIdList,childrenMenu.menuId)}">
						<div class="layui-input-block"
							th:each="threeMenu:${childrenMenu?.children}">
							<input type="checkbox" name="menuList"
								lay-filter="checkedListener" th:value="${threeMenu.menuId }"
								lay-skin="primary" th:title="${threeMenu.title }"
								th:checked="${#lists.contains(role.menuIdList,threeMenu.menuId)}">
						</div>
					</div>

				</fieldset>
			</div>
			<div class="layui-input-block" th:case="false">
				<fieldset th:each="menu:${menus}">
					<legend>
						<input type="checkbox" name="menuList" th:value="${menu.menuId }"
							lay-skin="primary" lay-filter="checkedListener"
							th:title="${menu.title }">
					</legend>
					<div class="layui-input-block"
						th:each="childrenMenu:${menu?.children}">
						<input type="checkbox" name="menuList"
							lay-filter="checkedListener" th:value="${childrenMenu.menuId }"
							lay-skin="primary" th:title="${childrenMenu.title }">
						<div class="layui-input-block"
							th:each="threeMenu:${childrenMenu?.children}">
							<input type="checkbox" name="menuList"
								lay-filter="checkedListener" th:value="${threeMenu.menuId }"
								lay-skin="primary" th:title="${threeMenu.title }">
						</div>
					</div>


				</fieldset>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">具体描述</label>
			<div class="layui-input-block">
				<textarea type="text" name="roleRemark" lay-verify="roleRemark"
					autocomplete="off" class="layui-textarea">[[${role?.roleRemark}]]</textarea>
			</div>
		</div>
		<div class="layui-form-item layui-hide">
			<button class="layui-btn" lay-submit
				lay-filter="LAY-user-role-submit" id="LAY-user-role-submit">提交</button>
		</div>
	</div>
	<script>
		layui.config({
			base : webRoot + '/js/' //静态资源所在路径
		}).use('roleform');
	</script>
</body>
</html>